<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-led-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">LED显示编号：</label>
            <div class="col-sm-8">
                <input id="led_id" name="led_id" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">用户编号：</label>
            <div class="col-sm-8">
                <input id="uid" name="uid" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">终端号：</label>
            <div class="col-sm-8">
                <input id="tid" name="tid" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">LED显示文字信息：</label>
            <div class="col-sm-8">
                <input id="content" name="content" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">开始显示时间：</label>
            <div class="col-sm-8">
                <input class="form-control" type="date" name="stardate" id="stardate">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">显示结束时间：</label>
            <div class="col-sm-8">
                <input class="form-control" type="date" name="enddate" id="enddate">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">特效：</label>
            <div class="col-sm-8">
                <input id="effect" name="effect" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">颜色：</label>
            <div class="col-sm-8">
                <input id="color" name="color" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <input id="demo" name="demo" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">是否有效：</label>
            <div class="col-sm-8">
                <input id="remark" name="remark" class="form-control" type="text">
            </div>
        </div>

    </form>
</div>
<div th:include="include::footer"></div>
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
<script type="text/javascript">
    var prefix = ctx + "iot/led"

    $("#form-energy-add").validate({
        rules:{
            xxxx:{
                required:true,
            },
        }
    });



    function add() {
        var led_id = $("input[name='led_id']").val();
        var uid = $("input[name='uid']").val();
        var tid = $("input[name='tid']").val();
        var content = $("input[name='content']").val();
        var effect = $("input[name='effect']").val();
        var color = $("input[name='color']").val();
        var demo = $("input[name='demo']").val();
        var remark = $("input[name='remark']").val();
        $.ajax({
            cache : true,
            type : "POST",
            url : ctx + "iot/led",
            data : {
                "led_id": led_id,
                "uid": uid,
                "tid": tid,
                "content": content,
                "effect": effect,
                "color": color,
                "demo": demo,
                "remark": remark,
            },
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(data);
            }
        });
    }

    function submitHandler() {
        if ($.validate.form()) {
            add();
        }
    }

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-led-add').serialize());
        }
    }
</script>
</body>
</html>
